package java_9_16zy.Test_2;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Caipiao implements Serializable {
    private int blue;//篮球
    List l = new ArrayList();//红球
    private int count=0;//记录重复红球
 //无参构造
    public Caipiao() {

    }
 //有参构造
    public Caipiao(int blue, List l) {
        this.blue = blue;
        this.l = l;
    }

    public int getBlue() {
        return blue;
    }

    public void setBlue(int blue) {
        this.blue = blue;
    }

    @Override
    public String toString() {
        return "彩票{" +
                "篮球=" + blue +
                ",红球=" + l +
                '}';
    }

    public void  cc(Caipiao c){
        for (int i = 0; i < 6; i++) {
            for (int j = 0; j < 6; j++) {
                if (c.l.get(j).equals(l.get(i))){
                    count++;
                }
            }
        }
        if (c.blue==this.blue){
            switch (count){
                case 1:
                    System.out.println("中了六等奖");
                    break;
                case 2:
                    System.out.println("中了六等奖");
                    break;
                case 3:
                    System.out.println("中了五等奖");
                    break;
                case 4:
                    System.out.println("中了四等奖");
                    break;
                case 5:
                    System.out.println("中了三等奖");
                    break;
                case 6:
                    System.out.println("中了一等奖");
                    break;
            }
        }else{
            switch (count){
                case 1:
                    break;
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    System.out.println("中了五等奖");
                    break;
                case 5:
                    System.out.println("中了四等奖");
                    break;
                case 6:
                    System.out.println("中了二等奖");
                    break;
            }
        }
    }
}
